package com.android.delivery.adapter

import com.android.delivery.App
import com.android.delivery.R
import com.android.delivery.entity.Addr
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder

/**
 * @author: mqwang
 * @create: 2/10/21 12:11 AM
 * @Description:
 */
class AddrAdapter : BaseQuickAdapter<Addr, BaseViewHolder>(R.layout.adapter_addr) {

    override fun convert(helper: BaseViewHolder?, item: Addr?) {
        helper!!.setText(R.id.tv_name, item!!.name + "   " + item!!.mobile)
        helper!!.setText(R.id.tv_addr, item!!.province + item!!.city + item!!.district + item!!.street + item.address)

        helper.addOnClickListener(R.id.tv_edit).addOnClickListener(R.id.tv_delete)

        val role = App.getInstance()?.getLoginInfo()?.role
        if (role == 1) {
            helper.setGone(R.id.tv_delete, true)
        } else {
            helper.setGone(R.id.tv_delete, false)
        }
    }
}